package com.wom.blocks;

import java.awt.Color;
import java.awt.Graphics;
import com.wom.blockfeatures.BlockRenderer;
import com.wom.blockfeatures.BlockUtils;
import com.wom.blockfeatures.BreakableBlock;
import com.wom.gui.BlockTypes;


public class DirtBlock extends AbstractBlock {


	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;


	public BreakableBlock breakable;
	
	
	public BlockRenderer renderble;



	public DirtBlock(int xPos, int yPos) {
		super(xPos, yPos);
		
		
		int[] tileId={2,0};
		setId(tileId);
		setName("Dirt");
		setColor(new Color(255,100,100));
		renderble=new BlockRenderer();
		breakable=new BreakableBlock(100, 3);

		
		
	}


	@Override
	public void renderBlock(Graphics g) {
		if(BlockUtils.getBlockAbove(this) instanceof AirBlock){
			id[0]=3;
			id[1]=0;

		}else{
			id[0]=2;
			id[1]=0;
		}
		renderble.renderBlock(this, g);
		//renderble.renderBlockFrame(this, g, Color.BLACK);
		
	}


	@Override
	public void updateBlock() {
		if(BlockUtils.isIsolatedBlock(this, BlockTypes.air)){
			BlockUtils.changeInto(getxPos(),getyPos(),BlockTypes.air);
		}
		
	}


	

	


}
